package com.example.springboot.service.imp;

import com.example.springboot.bean.TSStudent;
import com.example.springboot.repository.StudentRepository;
import com.example.springboot.service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;

/**
 * Created by tang on 2017/11/16.
 */
@Service
public class StudentServiceImp implements StudentService {
    @Resource
    StudentRepository studentRepository;


    @Override
    @Transactional
    public void save(TSStudent student) {
        studentRepository.save(student);
    }

    @Override
    @Transactional
    public void delect(int id) {
        studentRepository.delete(id);

    }

    @Override
    @Transactional
    public void update(TSStudent student) {
        studentRepository.save(student);
    }

    @Override
    @Transactional
    public Iterable<TSStudent> getAll() {
        return studentRepository.findAll();
    }
}
